package com.example.judgepaper.service.ServiceImpl;

import com.example.judgepaper.mapper.StudentStateChangeMapper;
import com.example.judgepaper.service.StudentStateChangeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Slf4j
@Service
@Transactional
public class StudentStateChangeImpl implements StudentStateChangeService {

    private final StudentStateChangeMapper studentStateChangeMapper;

    public StudentStateChangeImpl(StudentStateChangeMapper studentStateChangeMapper) {
        this.studentStateChangeMapper = studentStateChangeMapper;
    }

    @Override
    public boolean studentState(String testId, String studentId) {
        int status = 1;
        return studentStateChangeMapper.updateStudentState(studentId, testId, status);
    }

    @Override
    public boolean classState(String testId, String teacherId) {
        String status = "1";
        return studentStateChangeMapper.updateClassState(teacherId,testId,status);
    }
}
